package com.nbsaas.boot.finance.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

import java.math.BigDecimal;
import java.util.Date;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "供应商", model = "供应商")
@Entity
@Table(name = "bs_supplier")
@Comment("供应商表")
public class Supplier extends AbstractEntity {

    @Comment("供应商编码")
    @SearchItem(name = "supplierCode", key = "supplierCode", label = "供应商编码")
    @FormField(title = "供应商编码", sortNum = "1", grid = true, required = true)
    @Column(length = 50, nullable = false, unique = true)
    private String supplierCode;

    @Comment("供应商名称")
    @SearchItem(name = "name", key = "name", label = "供应商名称")
    @FormField(title = "供应商名称", sortNum = "2", grid = true, required = true)
    @Column(length = 200, nullable = false)
    private String name;

    @Comment("供应商简称")
    @FormField(title = "供应商简称", sortNum = "3", grid = true)
    @Column(length = 100)
    private String shortName;

    @Comment("供应商类型")
    @FormField(title = "供应商类型", sortNum = "4", grid = true, type = InputType.select)
    @Column(length = 50)
    private String supplierType;

    @Comment("企业性质")
    @FormField(title = "企业性质", sortNum = "5", grid = true, type = InputType.select)
    @Column(length = 50)
    private String enterpriseNature;

    @Comment("注册资本")
    @FormField(title = "注册资本", sortNum = "6", grid = true, type = InputType.el_input_number)
    @Column(precision = 15, scale = 2)
    private BigDecimal registeredCapital;

    @Comment("成立日期")
    @FormField(title = "成立日期", sortNum = "7", type = InputType.date, grid = true)
    private Date establishmentDate;

    @Comment("统一社会信用代码")
    @FormField(title = "统一社会信用代码", sortNum = "8", grid = true)
    @Column(length = 50)
    private String creditCode;

    @Comment("营业执照号")
    @FormField(title = "营业执照号", sortNum = "9", grid = true)
    @Column(length = 50)
    private String businessLicense;

    @Comment("税务登记号")
    @FormField(title = "税务登记号", sortNum = "10", grid = true)
    @Column(length = 50)
    private String taxRegistration;

    @Comment("联系人")
    @SearchItem(name = "contactPerson", key = "contactPerson", label = "联系人")
    @FormField(title = "联系人", sortNum = "11", grid = true)
    @Column(length = 100)
    private String contactPerson;

    @Comment("联系电话")
    @FormField(title = "联系电话", sortNum = "12", grid = true)
    @Column(length = 20)
    private String contactPhone;

    @Comment("联系邮箱")
    @FormField(title = "联系邮箱", sortNum = "13", grid = true)
    @Column(length = 100)
    private String contactEmail;

    @Comment("传真")
    @FormField(title = "传真", sortNum = "14", grid = true)
    @Column(length = 20)
    private String fax;

    @Comment("公司地址")
    @FormField(title = "公司地址", sortNum = "15", grid = true)
    @Column(length = 500)
    private String address;

    @Comment("邮政编码")
    @FormField(title = "邮政编码", sortNum = "16", grid = true)
    @Column(length = 10)
    private String postcode;

    @Comment("公司网站")
    @FormField(title = "公司网站", sortNum = "17", grid = true)
    @Column(length = 200)
    private String website;

    @Comment("经营范围")
    @FormField(title = "经营范围", sortNum = "18", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String businessScope;

    @Comment("供应商等级")
    @FormField(title = "供应商等级", sortNum = "19", grid = true, type = InputType.select)
    @Column(length = 20)
    private String supplierLevel;

    @Comment("合作状态")
    @FormField(title = "合作状态", sortNum = "20", grid = true, type = InputType.select)
    @Column(length = 20)
    private String cooperationStatus;

    @Comment("付款条件")
    @FormField(title = "付款条件", sortNum = "21", grid = true)
    @Column(length = 200)
    private String paymentTerms;

    @Comment("信用额度")
    @FormField(title = "信用额度", sortNum = "22", grid = true, type = InputType.el_input_number)
    @Column(precision = 15, scale = 2)
    private BigDecimal creditLimit;

    @Comment("已用额度")
    @FormField(title = "已用额度", sortNum = "23", grid = true, type = InputType.el_input_number)
    @Column(precision = 15, scale = 2)
    private BigDecimal usedCredit;

    @Comment("供应商评分")
    @FormField(title = "供应商评分", sortNum = "24", grid = true, type = InputType.el_input_number, sort = true)
    @Column(precision = 5, scale = 2)
    private BigDecimal supplierScore;

    @Comment("备注")
    @FormField(title = "备注", sortNum = "25", type = InputType.textarea)
    @Column(columnDefinition = "text")
    private String remark;
} 